<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>
        //每隔一段时间就会触发
        var i = 0;
        setInterval(function(){
            i++;
            console.log(i);
        },1000);

    </script>

</body>
</html>